package com.ruoyi.project.drug.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.drug.domain.DrugSupplier;
import com.ruoyi.project.drug.mapper.DrugSupplierMapper;
import com.ruoyi.project.drug.service.IDrugSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DrugSupplierServiceImpl implements IDrugSupplierService {

    @Autowired
    private DrugSupplierMapper drugSupplierMapper;

    //查询供应商
    @Override
    public DrugSupplier selectDrugSupplierById(Long supId)
    {
        return drugSupplierMapper.selectDrugSupplierById(supId);
    }

    //动态查询供应商
    @Override
    public List<DrugSupplier> selectDrugSupplierList(DrugSupplier drugSupplier)
    {
        return drugSupplierMapper.selectDrugSupplierList(drugSupplier);
    }

    /**
     * 新增【供应商】
     *
     * @param drugSupplier 【供应商】
     * @return 结果
     */
    @Override
    public int insertDrugSupplier(DrugSupplier drugSupplier)
    {
        drugSupplier.setCreateTime(DateUtils.getNowDate());
        return drugSupplierMapper.insertDrugSupplier(drugSupplier);
    }

    /**
     * 修改【供应商】
     *
     * @param drugSupplier 【供应商】
     * @return 结果
     */
    @Override
    public int updateDrugSupplier(DrugSupplier drugSupplier)
    {
        drugSupplier.setUpdateTime(DateUtils.getNowDate());
        return drugSupplierMapper.updateDrugSupplier(drugSupplier);
    }

    /**
     * 批量删除【供应商】
     *
     * @param supIds 需要删除的【供应商】ID
     * @return 结果
     */
    @Override
    public int deleteDrugSupplierByIds(Long[] supIds)
    {
        return drugSupplierMapper.deleteDrugSupplierByIds(supIds);
    }

    /**
     * 删除【供应商】信息
     *
     * @param supId 【供应商】ID
     * @return 结果
     */
    @Override
    public int deleteDrugSupplierById(Long supId)
    {
        return drugSupplierMapper.deleteDrugSupplierById(supId);
    }
}
